\(\int \cot ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx\) [23]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [A] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 134 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=4 a^3 (A-i B) x+\frac {a^3 (17 A-15 i B) \cot (c+d x)}{6 d}-\frac {4 a^3 (i A+B) \log (\sin (c+d x))}{d}-\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d}-\frac {(5 i A+3 B) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d} \]

[Out]

4*a^3*(A-I*B)*x+1/6*a^3*(17*A-15*I*B)*cot(d*x+c)/d-4*a^3*(I*A+B)*ln(sin(d*x+c))/d-1/3*a*A*cot(d*x+c)^3*(a+I*a*
tan(d*x+c))^2/d-1/6*(5*I*A+3*B)*cot(d*x+c)^2*(a^3+I*a^3*tan(d*x+c))/d

Rubi [A] (verified)

Time = 0.40 (sec) , antiderivative size = 134, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.118, Rules used = {3674, 3672, 3612, 3556} \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\frac {a^3 (17 A-15 i B) \cot (c+d x)}{6 d}-\frac {4 a^3 (B+i A) \log (\sin (c+d x))}{d}-\frac {(3 B+5 i A) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d}+4 a^3 x (A-i B)-\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d} \]

[In]

Int[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])^3*(A + B*Tan[c + d*x]),x]

[Out]

4*a^3*(A - I*B)*x + (a^3*(17*A - (15*I)*B)*Cot[c + d*x])/(6*d) - (4*a^3*(I*A + B)*Log[Sin[c + d*x]])/d - (a*A*
Cot[c + d*x]^3*(a + I*a*Tan[c + d*x])^2)/(3*d) - (((5*I)*A + 3*B)*Cot[c + d*x]^2*(a^3 + I*a^3*Tan[c + d*x]))/(
6*d)

Rule 3556

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> Simp[-Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3672

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e
_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*c - a*d)*(A*b - a*B)*((a + b*Tan[e + f*x])^(m + 1)/(b*f*(m + 1)*(a^2
+ b^2))), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e + f*x])^(m + 1)*Simp[a*A*c + b*B*c + A*b*d - a*B*d - (A*b*
c - a*B*c - a*A*d - b*B*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0]
 && LtQ[m, -1] && NeQ[a^2 + b^2, 0]

Rule 3674

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_
.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(-a^2)*(B*c - A*d)*(a + b*Tan[e + f*x])^(m - 1)*((c + d*Tan[e + f*x]
)^(n + 1)/(d*f*(b*c + a*d)*(n + 1))), x] - Dist[a/(d*(b*c + a*d)*(n + 1)), Int[(a + b*Tan[e + f*x])^(m - 1)*(c
 + d*Tan[e + f*x])^(n + 1)*Simp[A*b*d*(m - n - 2) - B*(b*c*(m - 1) + a*d*(n + 1)) + (a*A*d*(m + n) - B*(a*c*(m
 - 1) + b*d*(n + 1)))*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B}, x] && NeQ[b*c - a*d, 0] && E
qQ[a^2 + b^2, 0] && GtQ[m, 1] && LtQ[n, -1]

Rubi steps \begin{align*} \text {integral}& = -\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d}+\frac {1}{3} \int \cot ^3(c+d x) (a+i a \tan (c+d x))^2 (a (5 i A+3 B)-a (A-3 i B) \tan (c+d x)) \, dx \\ & = -\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d}-\frac {(5 i A+3 B) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d}+\frac {1}{6} \int \cot ^2(c+d x) (a+i a \tan (c+d x)) \left (-a^2 (17 A-15 i B)-a^2 (7 i A+9 B) \tan (c+d x)\right ) \, dx \\ & = \frac {a^3 (17 A-15 i B) \cot (c+d x)}{6 d}-\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d}-\frac {(5 i A+3 B) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d}+\frac {1}{6} \int \cot (c+d x) \left (-24 a^3 (i A+B)+24 a^3 (A-i B) \tan (c+d x)\right ) \, dx \\ & = 4 a^3 (A-i B) x+\frac {a^3 (17 A-15 i B) \cot (c+d x)}{6 d}-\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d}-\frac {(5 i A+3 B) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d}-\left (4 a^3 (i A+B)\right ) \int \cot (c+d x) \, dx \\ & = 4 a^3 (A-i B) x+\frac {a^3 (17 A-15 i B) \cot (c+d x)}{6 d}-\frac {4 a^3 (i A+B) \log (\sin (c+d x))}{d}-\frac {a A \cot ^3(c+d x) (a+i a \tan (c+d x))^2}{3 d}-\frac {(5 i A+3 B) \cot ^2(c+d x) \left (a^3+i a^3 \tan (c+d x)\right )}{6 d} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.04 (sec) , antiderivative size = 89, normalized size of antiderivative = 0.66 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\frac {a^3 \left (6 (4 A-3 i B) \cot (c+d x)+(-9 i A-3 B) \cot ^2(c+d x)-2 A \cot ^3(c+d x)-24 i (A-i B) (\log (\tan (c+d x))-\log (i+\tan (c+d x)))\right )}{6 d} \]

[In]

Integrate[Cot[c + d*x]^4*(a + I*a*Tan[c + d*x])^3*(A + B*Tan[c + d*x]),x]

[Out]

(a^3*(6*(4*A - (3*I)*B)*Cot[c + d*x] + ((-9*I)*A - 3*B)*Cot[c + d*x]^2 - 2*A*Cot[c + d*x]^3 - (24*I)*(A - I*B)
*(Log[Tan[c + d*x]] - Log[I + Tan[c + d*x]])))/(6*d)

Maple [A] (verified)

Time = 0.20 (sec) , antiderivative size = 104, normalized size of antiderivative = 0.78

method result size
parallelrisch \(-\frac {4 a^{3} \left (\left (-\frac {i A}{2}-\frac {B}{2}\right ) \ln \left (\sec ^{2}\left (d x +c \right )\right )+\left (i A +B \right ) \ln \left (\tan \left (d x +c \right )\right )+\frac {13 A \left (\cot ^{3}\left (d x +c \right )\right )}{12}+\left (\cot ^{2}\left (d x +c \right )\right ) \left (\frac {3 i A}{8}+\frac {B}{8}\right )+\left (-A \left (\csc ^{2}\left (d x +c \right )\right )+\frac {3 i B}{4}\right ) \cot \left (d x +c \right )+x d \left (i B -A \right )\right )}{d}\) \(104\)
derivativedivides \(\frac {a^{3} \left (-\frac {3 i A \left (\cot ^{2}\left (d x +c \right )\right )}{2}-\frac {A \left (\cot ^{3}\left (d x +c \right )\right )}{3}-3 i B \cot \left (d x +c \right )-\frac {B \left (\cot ^{2}\left (d x +c \right )\right )}{2}+4 A \cot \left (d x +c \right )+\frac {\left (4 i A +4 B \right ) \ln \left (\cot ^{2}\left (d x +c \right )+1\right )}{2}+\left (4 i B -4 A \right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )\right )}{d}\) \(105\)
default \(\frac {a^{3} \left (-\frac {3 i A \left (\cot ^{2}\left (d x +c \right )\right )}{2}-\frac {A \left (\cot ^{3}\left (d x +c \right )\right )}{3}-3 i B \cot \left (d x +c \right )-\frac {B \left (\cot ^{2}\left (d x +c \right )\right )}{2}+4 A \cot \left (d x +c \right )+\frac {\left (4 i A +4 B \right ) \ln \left (\cot ^{2}\left (d x +c \right )+1\right )}{2}+\left (4 i B -4 A \right ) \left (\frac {\pi }{2}-\operatorname {arccot}\left (\cot \left (d x +c \right )\right )\right )\right )}{d}\) \(105\)
risch \(\frac {8 i a^{3} B c}{d}-\frac {8 a^{3} A c}{d}+\frac {2 a^{3} \left (24 i A \,{\mathrm e}^{4 i \left (d x +c \right )}+12 B \,{\mathrm e}^{4 i \left (d x +c \right )}-33 i A \,{\mathrm e}^{2 i \left (d x +c \right )}-21 B \,{\mathrm e}^{2 i \left (d x +c \right )}+13 i A +9 B \right )}{3 d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )^{3}}-\frac {4 a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) B}{d}-\frac {4 i a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right ) A}{d}\) \(145\)
norman \(\frac {\frac {\left (-3 i B \,a^{3}+4 A \,a^{3}\right ) \left (\tan ^{2}\left (d x +c \right )\right )}{d}+\left (-4 i B \,a^{3}+4 A \,a^{3}\right ) x \left (\tan ^{3}\left (d x +c \right )\right )-\frac {A \,a^{3}}{3 d}-\frac {\left (3 i A \,a^{3}+B \,a^{3}\right ) \tan \left (d x +c \right )}{2 d}}{\tan \left (d x +c \right )^{3}}-\frac {4 \left (i A \,a^{3}+B \,a^{3}\right ) \ln \left (\tan \left (d x +c \right )\right )}{d}+\frac {2 \left (i A \,a^{3}+B \,a^{3}\right ) \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{d}\) \(149\)

[In]

int(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

-4*a^3*((-1/2*I*A-1/2*B)*ln(sec(d*x+c)^2)+(I*A+B)*ln(tan(d*x+c))+13/12*A*cot(d*x+c)^3+cot(d*x+c)^2*(3/8*I*A+1/
8*B)+(-A*csc(d*x+c)^2+3/4*I*B)*cot(d*x+c)+x*d*(-A+I*B))/d

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 181, normalized size of antiderivative = 1.35 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-\frac {2 \, {\left (12 \, {\left (-2 i \, A - B\right )} a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, {\left (11 i \, A + 7 \, B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-13 i \, A - 9 \, B\right )} a^{3} + 6 \, {\left ({\left (i \, A + B\right )} a^{3} e^{\left (6 i \, d x + 6 i \, c\right )} + 3 \, {\left (-i \, A - B\right )} a^{3} e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, {\left (i \, A + B\right )} a^{3} e^{\left (2 i \, d x + 2 i \, c\right )} + {\left (-i \, A - B\right )} a^{3}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right )\right )}}{3 \, {\left (d e^{\left (6 i \, d x + 6 i \, c\right )} - 3 \, d e^{\left (4 i \, d x + 4 i \, c\right )} + 3 \, d e^{\left (2 i \, d x + 2 i \, c\right )} - d\right )}} \]

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="fricas")

[Out]

-2/3*(12*(-2*I*A - B)*a^3*e^(4*I*d*x + 4*I*c) + 3*(11*I*A + 7*B)*a^3*e^(2*I*d*x + 2*I*c) + (-13*I*A - 9*B)*a^3
 + 6*((I*A + B)*a^3*e^(6*I*d*x + 6*I*c) + 3*(-I*A - B)*a^3*e^(4*I*d*x + 4*I*c) + 3*(I*A + B)*a^3*e^(2*I*d*x +
2*I*c) + (-I*A - B)*a^3)*log(e^(2*I*d*x + 2*I*c) - 1))/(d*e^(6*I*d*x + 6*I*c) - 3*d*e^(4*I*d*x + 4*I*c) + 3*d*
e^(2*I*d*x + 2*I*c) - d)

Sympy [A] (verification not implemented)

Time = 0.47 (sec) , antiderivative size = 182, normalized size of antiderivative = 1.36 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=- \frac {4 i a^{3} \left (A - i B\right ) \log {\left (e^{2 i d x} - e^{- 2 i c} \right )}}{d} + \frac {26 i A a^{3} + 18 B a^{3} + \left (- 66 i A a^{3} e^{2 i c} - 42 B a^{3} e^{2 i c}\right ) e^{2 i d x} + \left (48 i A a^{3} e^{4 i c} + 24 B a^{3} e^{4 i c}\right ) e^{4 i d x}}{3 d e^{6 i c} e^{6 i d x} - 9 d e^{4 i c} e^{4 i d x} + 9 d e^{2 i c} e^{2 i d x} - 3 d} \]

[In]

integrate(cot(d*x+c)**4*(a+I*a*tan(d*x+c))**3*(A+B*tan(d*x+c)),x)

[Out]

-4*I*a**3*(A - I*B)*log(exp(2*I*d*x) - exp(-2*I*c))/d + (26*I*A*a**3 + 18*B*a**3 + (-66*I*A*a**3*exp(2*I*c) -
42*B*a**3*exp(2*I*c))*exp(2*I*d*x) + (48*I*A*a**3*exp(4*I*c) + 24*B*a**3*exp(4*I*c))*exp(4*I*d*x))/(3*d*exp(6*
I*c)*exp(6*I*d*x) - 9*d*exp(4*I*c)*exp(4*I*d*x) + 9*d*exp(2*I*c)*exp(2*I*d*x) - 3*d)

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 115, normalized size of antiderivative = 0.86 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\frac {24 \, {\left (d x + c\right )} {\left (A - i \, B\right )} a^{3} - 12 \, {\left (-i \, A - B\right )} a^{3} \log \left (\tan \left (d x + c\right )^{2} + 1\right ) - 24 \, {\left (i \, A + B\right )} a^{3} \log \left (\tan \left (d x + c\right )\right ) + \frac {6 \, {\left (4 \, A - 3 i \, B\right )} a^{3} \tan \left (d x + c\right )^{2} + 3 \, {\left (-3 i \, A - B\right )} a^{3} \tan \left (d x + c\right ) - 2 \, A a^{3}}{\tan \left (d x + c\right )^{3}}}{6 \, d} \]

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="maxima")

[Out]

1/6*(24*(d*x + c)*(A - I*B)*a^3 - 12*(-I*A - B)*a^3*log(tan(d*x + c)^2 + 1) - 24*(I*A + B)*a^3*log(tan(d*x + c
)) + (6*(4*A - 3*I*B)*a^3*tan(d*x + c)^2 + 3*(-3*I*A - B)*a^3*tan(d*x + c) - 2*A*a^3)/tan(d*x + c)^3)/d

Giac [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 254 vs. \(2 (116) = 232\).

Time = 0.76 (sec) , antiderivative size = 254, normalized size of antiderivative = 1.90 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=\frac {A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 9 i \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 3 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 51 \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 36 i \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 192 \, {\left (-i \, A a^{3} - B a^{3}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + i\right ) - 96 \, {\left (i \, A a^{3} + B a^{3}\right )} \log \left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right ) - \frac {-176 i \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 176 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 51 \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 36 i \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 9 i \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, B a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + A a^{3}}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3}}}{24 \, d} \]

[In]

integrate(cot(d*x+c)^4*(a+I*a*tan(d*x+c))^3*(A+B*tan(d*x+c)),x, algorithm="giac")

[Out]

1/24*(A*a^3*tan(1/2*d*x + 1/2*c)^3 - 9*I*A*a^3*tan(1/2*d*x + 1/2*c)^2 - 3*B*a^3*tan(1/2*d*x + 1/2*c)^2 - 51*A*
a^3*tan(1/2*d*x + 1/2*c) + 36*I*B*a^3*tan(1/2*d*x + 1/2*c) - 192*(-I*A*a^3 - B*a^3)*log(tan(1/2*d*x + 1/2*c) +
 I) - 96*(I*A*a^3 + B*a^3)*log(tan(1/2*d*x + 1/2*c)) - (-176*I*A*a^3*tan(1/2*d*x + 1/2*c)^3 - 176*B*a^3*tan(1/
2*d*x + 1/2*c)^3 - 51*A*a^3*tan(1/2*d*x + 1/2*c)^2 + 36*I*B*a^3*tan(1/2*d*x + 1/2*c)^2 + 9*I*A*a^3*tan(1/2*d*x
 + 1/2*c) + 3*B*a^3*tan(1/2*d*x + 1/2*c) + A*a^3)/tan(1/2*d*x + 1/2*c)^3)/d

Mupad [B] (verification not implemented)

Time = 7.34 (sec) , antiderivative size = 93, normalized size of antiderivative = 0.69 \[ \int \cot ^4(c+d x) (a+i a \tan (c+d x))^3 (A+B \tan (c+d x)) \, dx=-\frac {\frac {A\,a^3}{3}-{\mathrm {tan}\left (c+d\,x\right )}^2\,\left (4\,A\,a^3-B\,a^3\,3{}\mathrm {i}\right )+\mathrm {tan}\left (c+d\,x\right )\,\left (\frac {B\,a^3}{2}+\frac {A\,a^3\,3{}\mathrm {i}}{2}\right )}{d\,{\mathrm {tan}\left (c+d\,x\right )}^3}-\frac {a^3\,\mathrm {atan}\left (2\,\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B+A\,1{}\mathrm {i}\right )\,8{}\mathrm {i}}{d} \]

[In]

int(cot(c + d*x)^4*(A + B*tan(c + d*x))*(a + a*tan(c + d*x)*1i)^3,x)

[Out]

- ((A*a^3)/3 - tan(c + d*x)^2*(4*A*a^3 - B*a^3*3i) + tan(c + d*x)*((A*a^3*3i)/2 + (B*a^3)/2))/(d*tan(c + d*x)^
3) - (a^3*atan(2*tan(c + d*x) + 1i)*(A*1i + B)*8i)/d